package createTargetArray;

import java.util.ArrayList;
import java.util.LinkedList;

public class Solution {
    public int[] createTargetArray(int[] nums, int[] index) {
        int[] target = new int[nums.length];
        LinkedList<Integer> list = new LinkedList<>();
        for (int i = 0; i < nums.length; i++) {
            list.add(index[i],nums[i]);
        }
        int i = 0;
        for (int v: list) {
            target[i++] = v;
        }
        return target;
    }
}
